import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { Modal } from 'ant-design-vue';
import { createVNode } from 'vue';

export default function useConfirm(
  options: {
    wrapClassName: string;
    title?: string;
    content?: string;
    onOk?: VoidFunction;
    onCancel?: VoidFunction;
  } = {
    wrapClassName: '',
    title: '提示',
    content: '',
    onOk: () => {},
    onCancel: () => {},
  }
) {
  Modal.confirm({
    wrapClassName: options.wrapClassName,
    title: options.title,
    icon: createVNode(ExclamationCircleOutlined),
    content: options.content,
    onOk: options.onOk,
    onCancel: options.onCancel,
  });
}
